<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <title>申购人列表</title>
    <script type="text/javascript">
      var editApplicantWin;
      var changePasswordWin;
      var applicantId;
      Ext.onReady(function(){
        //审批人列表---------------------------------------------------------
        //生成有关审批人的Grid
        var applicantDS = new Ext.data.Store({
          paramNames: {
            start: "start",
            limit: "limit"
          },
          baseParams: {
            start: 0,
            limit: 15
          },
          proxy: new Ext.data.HttpProxy({
            url: '/applicant/getMyInformation'
          }),
          reader: new Ext.data.JsonReader({
            totalProperty: 'totalProperty',
            root: 'root'
          }, [{
              name: 'id'
            },{
              name: 'login_id'
            }, {
              name: 'name'
            }, {
              name: 'department_name',
              mapping:'department.name'
            }, {
              name: 'phone'
            }, {
              name: 'mobile'
            }, {
              name: 'email'
            }])
        });
        var applicantSM = new Ext.grid.CheckboxSelectionModel();
        var applicantCM = new Ext.grid.ColumnModel([new Ext.grid.RowNumberer(),applicantSM,{
            header: '我的编号',
            dataIndex: 'login_id',
            width:180
          },{
            header: '我的姓名',
            dataIndex: 'name',
            width:180
          }, {
            header: '部门',
            dataIndex: 'department_name',
            width:130
          }, {
            header: '固定电话',
            dataIndex: 'phone',
            width:130
          }, {
            header: '移动电话',
            dataIndex: 'mobile',
            width:110
          }, {
            header: 'Email',
            dataIndex: 'email',
            width:200
          }]);
        var applicantGrid =  new Ext.grid.GridPanel({
          ds: applicantDS,
          cm: applicantCM,
          sm: applicantSM,
          width: screenWidth-330,
          height: screenHeight-320,
          iconCls: 'icon-grid',
          loadMask: true,
          //collapsible: true,
          //animCollapse: false,
          //frame: true,
          //title: '客户列表',
          tbar:[{
            text: '编辑个人信息',
            width:50,
            iconCls:'editItem',
            handler:function(){
                  editApplicantWin = new Ext.Window({
                    title: '编辑我的信息',
                    layout:'fit',
                    width:617,
                    height:234,
                    closeAction:'destroy',
                    constrain:true,
                    plain: true,
                    modal: true,
                    autoLoad: {
                      url: "/applicant/editApplicantInformation",
                      scripts: true
                    }
                  });
                  editApplicantWin.on("destroy",function(){
                    applicantDS.reload();
                  });
                  editApplicantWin.resizable = false;
                  editApplicantWin.show();
            }
          },'-',{
            text: '修改密码',
            width:50,
            iconCls:'editItem',
            handler:function(){
                  changePasswordWin = new Ext.Window({
                    title: '修改密码',
                    layout:'fit',
                    width:417,
                    height:165,
                    closeAction:'destroy',
                    constrain:true,
                    plain: true,
                    modal: true,
                    autoLoad: {
                      url: "/applicant/password",
                      scripts: true
                    }
                  });
                  changePasswordWin.on("destroy",function(){
                    applicantDS.reload();
                  });
                  changePasswordWin.resizable = false;
                  changePasswordWin.show();
            }
          }
          ],
          bbar: new Ext.PagingToolbar({
            pageSize: 10,
            store: applicantDS,
            displayInfo: true,
            displayMsg: "显示第 {0} 条到 {1} 条记录，一共 {2} 条",
            emptyMsg: "没有记录"
          })
        });
        applicantGrid.render('applicant_list');
        applicantDS.load();
      })
    </script>
  </head>
  <body>
    <div id="applicant_list"></div>
  </body>
</html>
